1. Field of the Invention
The present invention relates to a method of maintaining a network connection. More particularly, the present invention relates to a method of maintaining a network connection between an electronic apparatus and a server.
2. Description of the Related Art
If the common user wants to connect to a remote server via a computer, the user must build a connection path via a network or other related devices (such as a router or a switch). In the prior art, the computer uses a fixed IP. Thus, if the computer and the server are disconnected, the server can still find the corresponding computer to connect via the fixed IP address. However, most computers currently use a dynamic IP. If the computer does not send a packet to the server within a certain time, the router in the connection path may close the port of the computer, such that the server will be unable to find the IP address of the corresponding computer, and such that the computer and the server will be disconnected. At this point, the computer must initiate a connection to the server to restore the previous connection state. However, if the computer is in a special mode (such as a sleep mode or a standby mode), the computer must send the packets periodically to the server for maintaining the connection between the computer and the server.
If the abovementioned computer sends the packets too often, the computer resources will be consumed unnecessarily. If the time interval between packets is too long, the server and the computer may be disconnected. Also, the connection path between the computer and the server usually passes through multiple routers, and the time setting for closing the port of every router is different. Therefore, it is necessary to determine a preferred interval for the computer to send the packet.